<template>
  <div class="confirm-layer" @click.self="cancel">
    <div class="confirm-box">
      <p class="title" v-if="title">{{ title }}</p>
      <div class="msg" v-if="msg">{{ msg }}</div>
      <div class="action">
        <div class="cancel" @click="cancel">{{ cancelBtn || '取消' }}</div>
        <div class="confirm" @click="confirm">{{ confirmBtn || '确定' }}</div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {};
    },
    mounted() {},
    methods: {
      cancel() {
        this.callback(false);
      },
      confirm() {
        this.callback(true);
      },
    },
  };
</script>

<style lang="less" scoped>
  .confirm-layer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 750px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    z-index: 111111;
    font-size: 28px;
    .confirm-box {
      width: 540px;
      background: #ffffff;
      border-radius: 20px;
      padding: 48px;
      text-align: center;
      margin: 45% auto auto;
      .title {
        font-size: 32px;
        font-weight: 800;
        color: #111111;
      }
      .msg {
        font-weight: 400;
        color: #888888;
        line-height: 47px;
        text-align: left;
        margin: 40px 0;
      }
      .action {
        display: flex;
        .cancel {
          font-weight: 400;
          color: #111111;
          flex: 1;
        }
        .confirm {
          font-weight: bold;
          color: #2247ff;
          border-left: 2px solid #d9d9d9;
          flex: 1;
        }
      }
    }
  }
</style>
